
<%-------------------------------------------------------------------
 * 页面名称：/page/transaction/innerCollect_1.jsp
 * 功能描述：网上收款
 * Action  : 
 *
 *-------------------------------------------------------------------
--%>

<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-tiles.tld" prefix="tiles"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-bean.tld" prefix="bean"%>
<%
String path = request.getContextPath();
%>
<script type='text/javascript' src='<%=path%>/js/ufront.js'></script>
<script type='text/javascript'
	src='<%=path%>/dwr/interface/accountTemplate.js'></script>
<script type='text/javascript'
	src='<%=path%>/js/vnv/commonForCnAmount.js'></script>
<script type='text/javascript' src='<%=path%>/js/vnv/tomoney.js'></script>
<script language="JavaScript" type="text/JavaScript">
function submitProcess() {

var amount=document.getElementsByName("amount")[0].value;
		accountTemplate.confirmToRule("11",amount,show);
}

function show(data)
	{
		var formObj = document.forms[0];
		if(checkNecessaryInput(formObj)){
		var remark = formObj.remark.value;
		if(remark.length>85){
			alert("备注内容不能超过85个字！");
			formObj.remark.focus();
			return false;
		}
		
		if(data=="true")
		{
			alert("对不起，您的交易金额不符合规则！");
			document.getElementsByName("amount")[0].focus();
			return false;
		}
		if(document.getElementById('b2cable').value=="0"){
			if(confirm("您选择的收款方没有向个人用户支付的权限，您还是希望向他收款么？")){
				 formObj.submit();
			}
		}else{
	    formObj.submit();
	    }
	}
	}
function validateDebitAccount(v) {
	v = v.replace(/ /g,"");
	if (v=="") {
		document.forms[0].debit.value="";
		//document.forms[0].debit.focus();
		document.getElementById("accountName").value = "";
		return;
	} else {
		accountTemplate.validateAccount(v,check);
	}
}
function check(obj){
	if (obj == '-1'){
		alert('该账户不存在!');
		document.forms[0].debit.value="";
		//document.forms[0].debit.focus();
		document.getElementById("accountName").value = "";
		return;
	} else {
		getAccountNameByName(obj);
	}
}
function getAccountNameByName(value) {
	if(value == null) value = "";
	document.getElementById("accountName").value = value;
}
function setB2cable(value) {
	document.getElementById("b2cable").value = value;
}
function emailSelect(){
	agiledata.getUserInternal(emailPopup);
}
      
function emailPopup(data) {
	if(data) {
	 	openLayer("<%=path%>/page/common/selectEmail.do");
	} else {
		location.href="<%=path%>/page/util/session_invalid.jsp";
	}
}
function amountSelect(){
 	agiledata.getUserInternal(amountPopup);
}
function amountPopup(data) {
  	if(data) {
	 	openLayer("<%=path%>/page/common/simpleCalculator.jsp",400,200,false);
	} else {
		location.href="<%=path%>/page/util/session_invalid.jsp";
	}      
}
function kd(){
	var ss=getObj("amount").value;
	ss = ss.replace(/ /g,"");
	if (ss=="") {
		getObj("upperAmount").value="";
		return;
	}
	
	var sDispMsg = getChineseCurrencyString(ss);
	if(sDispMsg==-1) sDispMsg="错误的金额!";
	if(sDispMsg==-2) sDispMsg="太长的金额!";
	getObj("upperAmount").value=sDispMsg;
}
</script>
<div id="main">
	<div class="content_right">
		<div style="width:745px;margin-left:10px;">
			<div class="titleinfo">
				网上收款
			</div>
			<div class="edit_pass">
				<table width="100%" border="0" align="center" cellpadding="5"
					cellspacing="1">
					<html:form action="innerCollect" method="post">
						<html:hidden property="step" />
						<input type="hidden" name="b2cable" value="1" id="b2cable">
						<!--被收款方账户 -->
						<tr>
							<td width="25%" align="right" height="35px;">
								<span class="orang12b">*</span>被收款方账户：
							</td>
							<td width="75%" height="35px;">
								<html:text property="debit" alt="被收款方账户" size="50"
									styleClass="inputStyle"
									onblur="validateDebitAccount(this.value);accountTemplate.b2cavaiable(this.value,setB2cable);" />
								&nbsp;&nbsp;
								<img src="<%=path%>/images/icon_email.gif" width="13"
									height="10" border="0" style="cursor:hand"
									 />
									 <!-- title="请点击此按钮，选择交易对象" onclick="emailSelect()" -->
								<span class="font_gray">可以输入被收款方的Email或者手机</span>
							</td>
						</tr>
						<!-- 被收款方名称 -->
						<tr>
							<td align="right" height="35px;">
								被收款方名称：
							</td>
							<td width="75%" height="35px;">
								<input name="accountName" type="text" class="inputStyleNoborder"
									size="50" id="accountName" readonly />
							</td>
						</tr>
						<!-- 收款子账户 -->
						<tr>
							<td align="right" height="35px;">
								收款子账户：
							</td>
							<td width="75%" height="35px;">
								<div class="select">
									<div>
										<html:select property="creditSubAccountId">
											<html:options collection="subAccounts" property="id"
												labelProperty="accountName" />
										</html:select>
									</div>
								</div>
							</td>
						</tr>
						<!-- 收款金额 -->
						<tr>
							<td align="right" height="35px;">
								<span class="orang12b">*</span>收款金额：
							</td>
							<td width="75%" height="35px;">
								<html:text property="amount" size="50" alt="收款金额"
									styleClass="inputStyle"
									onblur="checkDecimalInput(this,0); tomoney('forms[0]','amount','hideTransAmt');kd();"
									onkeyup="kd();" onchange="kd();" />
								元 &nbsp;&nbsp;
								<img src="<%=path%>/images/money.gif" width="17" height="17"
									style="cursor:hand" title="请使用计算器，计算收款金额"
									onclick="amountSelect()" />
								<INPUT type="hidden" NAME="hideTransAmt" value="">
							</td>
						</tr>
						<!-- 收款金额大写 -->
						<tr>
							<td align="right" height="35px;">
								收款金额大写：
							</td>
							<td width="75%" height="35px;">
								<input name="upperAmount" type="text" class="inputStyleNoborder"
									size="50" readonly />
							</td>
						</tr>
						<!-- 交易模式 -->
						<tr>
							<td align="right" height="35px;">
								交易模式：
							</td>
							<td width="75%" height="35px;">
								<html:radio property="assured" value="true" style="border:0" />
								担保交易&nbsp;&nbsp;&nbsp;&nbsp;
								<html:radio property="assured" value="false" style="border:0" />
								非担保交易
							</td>
						</tr>
						<!--商品信息 -->
						<tr>
							<td align="right" height="35px;">
								商品信息：
							</td>
							<td width="75%" height="35px;">
								<html:text property="commodity" styleClass="inputStyle"
									size="50" maxlength="85" />
							</td>
						</tr>
						<!--资金用途 -->
						<tr>
							<td align="right" height="35px;">
								<span class="orang12b">*</span>资金用途：
							</td>
							<td width="75%" height="35px;">
								<html:text property="purpose" alt="资金用途" styleClass="inputStyle"
									size="50" maxlength="85" onblur="killSpace(this)" />
								<span class="font_gray">(最长85个字符)</span>
							</td>
						</tr>
						<!-- 备注 -->
						<tr>
							<td align="right" height="35px;">
								备注：
							</td>
							<td width="75%" height="35px;">
								<html:textarea property="remark" rows="5" cols="35"
									style="border:1px solid #ccc;" />
								<span class="font_gray">(最长85个字符)</span>
							</td>
						</tr>
						<tr>
							<td align="right"></td>
							<td>
								<font color="#FF0000"><html:errors /> </font>
							</td>
						</tr>
					</html:form>
					<tr>
						<td align="right"></td>
						<td with="75%">
							<input type="button" name="next" value="下一步" class="button_style"
								onclick="submitProcess();" style="margin-right:20px;" />
						</td>
					</tr>
				</table>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript" src="<%=path%>/js/layer.js"></script>
<script language="JavaScript" type="text/JavaScript">
function closeLayer(returnValue, type){
	hideLayer();
	if(type=="email"){
		document.forms[0].debit.value=returnValue[1];
		document.forms[0].debit.focus();
	}else if(type=="amount"){
		document.forms[0].amount.value=returnValue;
		document.forms[0].amount.focus();
		kd();
	}
}
</script>
